package com.jorado.etl.repository;

import com.jorado.search.core.service.Exporter;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.context.annotation.Description;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Mapper
@Repository
@Description("Rd数据库职位导出器")
public interface RdPositionRepository extends Exporter {

    @Select("SELECT count(*) FROM jorado.Job_position(nolock)")
    @Override
    long count();

    @Select("select * from (" +
            "select row_number() over(" +
            "order by id asc" +
            ") as num,job_title,job_position_number,jobdescription,jobclass,subjobclass from jorado.Job_position) " +
            "tbl where num>=#{start} and num<=(#{start}+#{rows})")
    @Override
    List<Map<String, Object>> listDatas(@Param("start") int start, @Param("rows") int rows);
}

